package com.liuc.practice.server.util;

/**
 * @Author Liu Chang
 * @Date 2021/7/21 10:45 下午
 */
public class HttpProtocolResponseUtil {

    /**
     * 响应成功的请求头
     * @param size
     * @return
     */
    public static String successHeader(int size) {
        return "HTTP/1.1 200 OK \n" +
                "Content-Type: text/html \n" +
                "Content-Length: " + size + "\n" +
                "\r\n" ;
    }

    public static String notFound() {
        String notFount = "404 NOT FOUND";
        return "HTTP/1.1 404 NOT FOUND \n" +
                "Content-Type: text/html \n" +
                "Content-Length: " + notFount.getBytes().length + "\n" +
                "\r\n" + notFount;
    }

}
